<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>模板定义的替代品</title>
  <script src="../../vue.js"></script>
</head>
<body>
  <script type="text/x-template" id="hello-world-template">
    <p v-once>{{address}}</p>
  </script>

  <div id="root">
    <!-- <comp1 inline-template>
      <div>{{address}}</div>
    </comp1> -->
    <comp1></comp1>
  </div>
  <script>
    Vue.config.productionTip = false

    const Comp1 = {
      template: '#hello-world-template',
      data() {
        return {
          address: 'address'
        }
      },
      mounted() {
        setTimeout(() => {
          this.address = 'address 2'
        }, 2000)
      },
    }

    var vm = new Vue({
      el: '#root',
      components: {
        Comp1
      }
    })
  </script>
</body>
</html>